<template>
  <div class="mod-config">
    <table-view ref="view"
                :searchAttrs="searchAttrs"
                :primaryKey="primaryKey"
                :listApiName="listApiName"
                :deleteApiName="deleteApiName"
                :exportApiName="exportApiName"
                :saveAuthName="saveAuthName"
                :deleteAuthName="deleteAuthName"
                :showAttrs="showAttrs"
    >
    </table-view>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    <consign-note-detail-add-or-update v-if="consignNoteDetailVisible" ref="consign" ></consign-note-detail-add-or-update>

  </div>
</template>


<script>
  import tableView from '@/components/tableView'
  import basicMixins from '@/utils/commonViewMixins'
  import AddOrUpdate from './consignnote-add-or-update'
  import ConsignNoteDetailAddOrUpdate from './consignnotedetail-add-or-update'

  export default {
    mixins: [basicMixins],
    data() {
      return {
        primaryKey: 'id',
        consignNoteDetailVisible: false,
        listApiName: 'consignApi/listConsignNoteList',
        deleteApiName: 'consignApi/deleteConsignNoteAdd',
        exportApiName: 'consignApi/getConsignNoteExport',
        saveAuthName: 'consign:consignnote:save',
        deleteAuthName: 'consign:consignnote:delete',
        searchAttrs: {},
        showAttrs: {
          consignNo: {
            label: "发货编号"
          },
          deliveryNumber: {
            label: "发货数量"
          },
          deliveryAddress: {
            label: "发货地址"
          },
          licencePlateId: {
            label: "车牌号"
          },
          deliveryTime: {
            label: "发货日期"
          },
          arriveTime: {
            label: "预计送达日期"
          },
          totalWeightInfo: {
            label: "重量"
          },
          freight: {
            label: "车费"
          },
          remark: {
            label: "备注"
          },
          status: {
            label: "状态"
          },

        }
      }
    },
    methods: {
      openConsignNoteDetailDialog(param, cb) {
        this.consignNoteDetailVisible = true
        this.$nextTick(() => {
          if (!this.R.isNil(this.$refs.consign)) {
            this.$refs.consign.init(param.id, param, cb, false)
          }
        })
      },
      exportOrderContract(id) {
        exportHandle('contractApi/getWordOrderContractExport', {contractOrderId: id})
      },
      deliveryOrderDetail(id){
        console.info('id ' + id)
      }

    },
    components: {
      tableView,
      ConsignNoteDetailAddOrUpdate,
      AddOrUpdate
    }
  }
</script>
